package com.xinwei.shard.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xinwei.shard.entity.TUserInfo;
import com.xinwei.shard.mapper.UserInfoMapper;
import com.xinwei.shard.service.UserInfoService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 描述 用户服务实现
 *
 * @author xinwei
 * @date 2024-04-26 17:11
 */
@Service
public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, TUserInfo> implements UserInfoService {
    @Override
    public List<TUserInfo> queryUser() {
        LambdaQueryWrapper<TUserInfo> tUserInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
        tUserInfoLambdaQueryWrapper.orderByDesc(TUserInfo::getCreateTime);
        return this.list(tUserInfoLambdaQueryWrapper);
    }

    @Override
    public IPage<TUserInfo> selectPageVo(IPage<TUserInfo> page) {
        LambdaQueryWrapper<TUserInfo> tUserInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
        tUserInfoLambdaQueryWrapper.orderByDesc(TUserInfo::getCreateTime);
        return this.page(page, tUserInfoLambdaQueryWrapper);
    }
}
